package dao.menu;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import entities.menu.MenuEntities;

public interface MenuDao {
    /**
     * 获得所有菜单
     * @return
     */
	List<MenuEntities> getMenu();
	/**
	 * 新增菜单
	 * @param menu
	 */
	void insertMenu(@Param("menu")MenuEntities menu);
	/**
	 * 更新菜单
	 * @param menu
	 */
	void updateMenu(@Param("menu")MenuEntities menu);
	/**
	 * 获得ID菜单的子菜单的最大位置
	 * @param id
	 */
	@Select("select max(location) from menu where parentId=#{id}")
	Integer getSubmenuMaxLocation(@Param("id")String id);
	/**
	 * 删除菜单
	 * @param id
	 */
	@Delete("delete FROM  menu where id=#{id} or parentId=#{id}")
	void deleteMenu(@Param("id")String id);
}
